// SPDX-License-Identifier: GPL-2.0
/*
 * JEMALLOC ON APPLICATION
 *
 * (C) 2024.05.23 BuddyZhang1 <buddy.zhang@aliyun.com>
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <jemalloc/jemalloc.h>

int main()
{
	char *ptr;

	/* ALLOC MEMORY FROM JEMALLOC */
	ptr = (char *)je_malloc(sizeof(char));
	if (!ptr)
		exit(-1);

	/* ACCESS MEMORY */
	*ptr = 'B';
	printf("JEMALLOC: %#lx %c\n", (unsigned long)ptr, *ptr);

	/* RECLAIM */
	je_free(ptr);

	return 0;
}
